package com.woniuxy.dao;

import com.woniuxy.controller.form.DefectConditionForm;
import com.woniuxy.controller.info.ProjectIdAndNameInfo;
import com.woniuxy.controller.info.ProjectIdAndNameInfo;
import com.woniuxy.model.Defect;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.woniuxy.model.DefectModelInfo;
import com.woniuxy.model.DefectWorkhourDay;
import com.woniuxy.model.DefectWorkmounthday;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;
import com.woniuxy.utils.GetSqlUtil;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 马世亮
 * @since 2022-02-15
 */
public interface DefectDao extends BaseMapper<Defect> {


    List<DefectModelInfo> selectAlldefectTypeNum(@Param("projectName") String projectName,@Param("time") String[] defectCreattime);



    List<DefectModelInfo> selectAlldefectserverityNum(@Param("projectName") String projectName,@Param("time") String[] defectCreattim);




    List<DefectModelInfo> selectAlldefectstateNum(@Param("projectName") String projectName,@Param("time") String[] defectCreattime);



    List<Defect> getDataofDefectType(@Param("projectName") String projectName,@Param("time") String[] defectCreattime);
    @SelectProvider(type = GetSqlUtil.class,method = "getDefectByConditionSql")
    List<Defect> getDefectByCondition(@Param("defectConditionForm") DefectConditionForm defectConditionForm);

    @SelectProvider(type = GetSqlUtil.class,method = "getDefectByProjectIds")
    List<Defect> selectMyProjectIsNewDefect(@Param("projectIds") List<Integer> projectIds,@Param("stateids") List<Integer> stateids);

    @Select("SELECT DISTINCT project_id,project_name FROM t_defect WHERE defect_createname_id=#{uid}")
    List<ProjectIdAndNameInfo> selectMyDefectProject(Integer uid);

    @SelectProvider(type = GetSqlUtil.class,method = "getNewDefectByConditionSql")
    List<Defect> selectDefectByConditionAndNew(@Param("defectConditionForm") DefectConditionForm defectConditionForm,@Param("stateids") List<Integer> stateids,@Param("projectIds") List<Integer> projectIds);

    @SelectProvider(type = GetSqlUtil.class,method = "getDefectByProjectIdsAndStateIdsSql")
    List<Defect> selectByMyProjectNoNewDefect(@Param("projectIds") List<Integer> projectIds,@Param("defectConditionForm") DefectConditionForm defectConditionForm,@Param("stateids") List<Integer> stateids);
}
